package com.cobra.rdd.operator.action

import org.apache.spark.{SparkConf, SparkContext}

object Spark10_RDD_Operator_CountByKey {
  def main(args: Array[String]): Unit = {

    val sparkConf = new SparkConf().setMaster("local[*]").setAppName("Spark10_RDD_Operator_CountByKey")
    val sc = new SparkContext(sparkConf)
    val rdd = sc.makeRDD(List(
      ("a",1),
      ("a",2),
      ("a",3),
    ))
    val stringToLong = rdd.countByKey()
    println(stringToLong)
    sc.stop()
  }
}
